import { v4 as uuidv4 } from "uuid";

// 先获取一下本地上的uuid

let uuid = localStorage.getItem("userTempId");

export const getUUID = () => {
  // 如果本地上没有uuid
  if (!uuid) {
    //生成uuid
    uuid = uuidv4();
    // 并存入本地localStorage中
    localStorage.setItem("userTempId", uuid);
  }
  // 将uuid返回出去
  return uuid;
};
